<?php
namespace app\admin\model;
use think\Model;
class Mainimg extends Model
{
public function SaveMainimg($img_info)
    {
        $mainimg = new Mainimg;
        if (!isset($img_info['id'])){
            $mainimg->describe = $img_info['describe'];
            $mainimg->path = $img_info['path'];
            $mainimg->created = time();
            $mainimg->save();
            $img_id = $mainimg->id;
            return $img_id;
        }
        $list = [
            'describe' => $img_info['describe'],
            'path' => $img_info['path'],
            'created' => time()
        ];
        return $mainimg->save($list,['id' => $img_info['id']]);
    }
    
    public function saveDescribe($describe,$img_id)
    {
        $mainimg = new Mainimg;
        $result = $mainimg->save(['describe' => $describe],['id' => $img_id]);
        return $result;
        
    }
}